package lesson2.pages;

import lesson2.api.ApplicationManager;
import lesson2.api.models.UserData;

import org.openqa.selenium.By;

public class RegistrationPage extends PageBase
{
	public RegistrationPage(ApplicationManager p_app)
	{
		super(p_app);
	}

	public void fillRegData(UserData p_userData)
	{
		// Fill registration data
		type(By.id("user_login"), p_userData.login);
		type(By.id("user_password"), p_userData.password);
		type(By.id("user_password_confirmation"), p_userData.password);
		type(By.id("user_firstname"), p_userData.firstName);
		type(By.id("user_lastname"), p_userData.lastName);
		type(By.id("user_mail"), p_userData.email);
		type(By.id("user_custom_field_values_7"), p_userData.skypeName);
		type(By.id("user_custom_field_values_10"), p_userData.phone);
		type(By.id("user_custom_field_values_28"), p_userData.department);
		type(By.id("user_custom_field_values_31"), p_userData.occupation);
		selectByValue(By.id("user_language"), p_userData.language);
	}

	public void submitRegData()
	{
		// Submit registration data
		click(By.name("commit"));
	}
}
